<cfcomponent name="FieldInstructorService" output="false">

	<cffunction name="init" access="public" output="false" returntype="FieldInstructorService">
		<cfargument name="FieldInstructorDAO" type="FieldInstructorDAO" required="true" />
		<cfargument name="FieldInstructorGateway" type="FieldInstructorGateway" required="true" />

		<cfset variables.FieldInstructorDAO = arguments.FieldInstructorDAO />
		<cfset variables.FieldInstructorGateway = arguments.FieldInstructorGateway />

		<cfreturn this/>
	</cffunction>

	<cffunction name="createFieldInstructor" access="public" output="false" returntype="FieldInstructor">
		<cfargument name="id" type="numeric" required="true" />
		<cfargument name="agencyId" type="numeric" required="false" />
		<cfargument name="title" type="string" required="false" />
		<cfargument name="firstName" type="string" required="false" />
		<cfargument name="lastName" type="string" required="false" />
		<cfargument name="degree" type="string" required="false" />
		<cfargument name="license" type="string" required="false" />
		<cfargument name="address1" type="string" required="false" />
		<cfargument name="address2" type="string" required="false" />
		<cfargument name="city" type="string" required="false" />
		<cfargument name="state" type="string" required="false" />
		<cfargument name="zipCode" type="string" required="false" />
		<cfargument name="phone" type="string" required="false" />
		<cfargument name="fax" type="string" required="false" />
		<cfargument name="cellPhone" type="string" required="false" />
		<cfargument name="pager" type="string" required="false" />
		<cfargument name="email" type="string" required="false" />
		<cfargument name="attendedTraining" type="boolean" required="false" />
		<cfargument name="attendedTraining2" type="boolean" required="false" />
		<cfargument name="attendSMdTraining" type="boolean" required="false" />
		<cfargument name="profile" type="boolean" required="false" />
		<cfargument name="homeAddress" type="string" required="false" />
		<cfargument name="homeCity" type="string" required="false" />
		<cfargument name="homeState" type="string" required="false" />
		<cfargument name="homeZipCode" type="string" required="false" />
		<cfargument name="homePhone" type="string" required="false" />
		<cfargument name="isActive" type="boolean" required="false" />
		<cfargument name="dateMostRecentInfo" type="date" required="false" />
		<cfargument name="Rating" type="string" required="false" />
		<cfargument name="leftAgency" type="boolean" required="false" />
		
			
		<cfset var FieldInstructor = createObject("component","FieldInstructor").init(argumentCollection=arguments) />
		<cfreturn FieldInstructor />
	</cffunction>

	<cffunction name="getFieldInstructor" access="public" output="false" returntype="FieldInstructor">
		<cfargument name="id" type="numeric" required="true" />
		
		<cfset var FieldInstructor = createFieldInstructor(argumentCollection=arguments) />
		<cfset variables.FieldInstructorDAO.read(FieldInstructor) />
		<cfreturn FieldInstructor />
	</cffunction>

	<cffunction name="getFieldInstructors" access="public" output="false" returntype="array">
		<cfargument name="id" type="numeric" required="false" />
		<cfargument name="agencyId" type="numeric" required="false" />
		<cfargument name="title" type="string" required="false" />
		<cfargument name="firstName" type="string" required="false" />
		<cfargument name="lastName" type="string" required="false" />
		<cfargument name="degree" type="string" required="false" />
		<cfargument name="license" type="string" required="false" />
		<cfargument name="address1" type="string" required="false" />
		<cfargument name="address2" type="string" required="false" />
		<cfargument name="city" type="string" required="false" />
		<cfargument name="state" type="string" required="false" />
		<cfargument name="zipCode" type="string" required="false" />
		<cfargument name="phone" type="string" required="false" />
		<cfargument name="fax" type="string" required="false" />
		<cfargument name="cellPhone" type="string" required="false" />
		<cfargument name="pager" type="string" required="false" />
		<cfargument name="email" type="string" required="false" />
		<cfargument name="attendedTraining" type="boolean" required="false" />
		<cfargument name="attendedTraining2" type="boolean" required="false" />
		<cfargument name="attendSMdTraining" type="boolean" required="false" />
		<cfargument name="profile" type="boolean" required="false" />
		<cfargument name="homeAddress" type="string" required="false" />
		<cfargument name="homeCity" type="string" required="false" />
		<cfargument name="homeState" type="string" required="false" />
		<cfargument name="homeZipCode" type="string" required="false" />
		<cfargument name="homePhone" type="string" required="false" />
		<cfargument name="isActive" type="boolean" required="false" />
		<cfargument name="dateMostRecentInfo" type="date" required="false" />
		<cfargument name="Rating" type="string" required="false" />
		<cfargument name="leftAgency" type="boolean" required="false" />
        <cfargument name="orderby" type="string" required="no" />
		
		<cfreturn variables.FieldInstructorGateway.getByAttributes(argumentCollection=arguments) />
	</cffunction>

	<cffunction name="saveFieldInstructor" access="public" output="false" returntype="struct">
		<cfargument name="FieldInstructor" type="FieldInstructor" required="true" />

		<cfreturn variables.FieldInstructorDAO.save(FieldInstructor) />
	</cffunction>

	<cffunction name="deleteFieldInstructor" access="public" output="false" returntype="struct">
		<cfargument name="id" type="numeric" required="true" />
		
		<cfset var FieldInstructor = createFieldInstructor(argumentCollection=arguments) />
		<cfreturn variables.FieldInstructorDAO.delete(FieldInstructor) />
	</cffunction>
</cfcomponent>
